tools/oxenstored: Make evaluation order explicit
authorChristian Lindig <christian.lindig@citrix.com>
Mon, 13 Aug 2018 16:26:56 +0000 (17:26 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Aug 2018 16:05:46 +0000 (17:05 +0100)
commite6441a804b76797c6ebac81b7d70ff19e5df9188
tree696c5bea0d7508b54a0bc5ed69341b81b41cd408
parent48fb482ef695c6b193ccfca665e6dd302eb230e2
tools/oxenstored: Make evaluation order explicit

In Store.path_write(), Path.apply_modify() updates the node_created
reference and both the value of apply_modify() and node_created are
returned by path_write().

At least with OCaml 4.06.1 this leads to the value of node_created being
returned *before* it is updated by apply_modify().  This in turn leads
to the quota for a domain not being updated in Store.write().  Hence, a
guest can create an unlimited number of entries in xenstore.

The fix is to make evaluation order explicit.

This is XSA-272.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: Rob Hoes <rob.hoes@citrix.com>
(cherry picked from commit 73392c7fd14c59f8c96e0b2eeeb329e4ae9086b6)
tools/ocaml/xenstored/store.ml